﻿/*
 * TLLogicContainer.h
 *
 *  Created on: Apr 28, 2015
 *      Author: yuliang
 */

#ifndef TLLOGICCONTAINER_H_
#define TLLOGICCONTAINER_H_

#include "logicbase/GLLogicBase.h"
#include "LLogicBase.h"
#include "logicbase/GLContainerBase.h"
#include "common/LSocket.h"

#include "ILogicPerson.h"
#include "scene/SceneManager.h"

class CTLLogicContainer : public CTLLogicBase {
public:
	CTLLogicContainer();
	virtual ~CTLLogicContainer();

	// 初始化(资源/业务)
	virtual void LogicInit();
	// 捕获此业务模块的业务包,是返回true,否则返回false
	virtual bool CatchLogic(const ProtocolBase *head, char * data, uint32_t len, void * connect);

	void SetBattleBody(uint8_t index);
	void SetWeapon(const ProtocolBase *head, LSocket* connect);

	void AddContainer(CGLContainerBase* container, uint8_t count, GoodsInfo* goods);
private:
	void onServer(const ProtocolBase *head, char * data, uint32_t len);
	void onClient(const ProtocolBase *head, char * data, uint32_t len);

	void onLoadContaierPack(const ProtocolBase *head, char * data, uint32_t len);
	void onLoadContaierBody(const ProtocolBase *head, char * data, uint32_t len);
	void onLoadContaierSoul(const ProtocolBase *head, char * data, uint32_t len);
	void onLoadContaierWeapon(const ProtocolBase *head, char * data, uint32_t len);
	void onLoadContaierStore(const ProtocolBase *head, char * data, uint32_t len);
	void onLoadContaier(CGLContainerBase* container, char* data);

	void onSetContainerPack(const ProtocolBase* head, char* data, uint32_t len);
	void onSetContainerBody(const ProtocolBase* head, char* data, uint32_t len);
};

#endif /* TLLOGICCONTAINER_H_ */
